Imports CapaDeDatos
Public Class nChequesTerceros
    Public ChequeTerceros As CapaDeDatos.dChequesTerceros = New CapaDeDatos.dChequesTerceros
    Public Alerta As CapaDeDatos.dAlerta = New CapaDeDatos.dAlerta

    Public Function InsertarCheque(ByVal CodigoCheque As String, _
                                            ByVal Importe As String, _
                                            ByVal FechaVence As String, _
                                            ByVal FechaEmision As String, _
                                            ByVal Observacion As String, _
                                            ByVal ANombreDe As String, _
                                            ByVal Estado As String, _
                                            ByVal Banco As String) As Boolean
        If FechaVence <> "" Then
            Alerta.Insertar("VENCIMIENTO - CHEQUE TERCEROS", ("Emitido por: " & ANombreDe.ToUpper & "-Por la Suma de:" & Importe).ToString, CDate(FechaVence).Date, CDate(FechaVence).Date, "", "", "")
        End If
        Return ChequeTerceros.Insertar(CodigoCheque _
                                    , Importe _
                                    , FechaVence _
                                    , FechaEmision _
                                    , Observacion _
                                    , ANombreDe _
                                    , Estado _
                                    , Banco)



    End Function
    Public Function ModificarCheque(ByVal CodigoCheque As String, _
                                            ByVal CodigoChequera As String, _
                                            ByVal CodigoProveedor As String, _
                                            ByVal Importe As String, _
                                            ByVal FechaVence As String, _
                                            ByVal FechaEmision As String, _
                                            ByVal Observacion As String, _
                                            ByVal ANombreDe As String, _
                                            ByVal Estado As String) As Boolean

        Return ChequeTerceros.Modificar(CodigoCheque _
                                    , Importe _
                                    , FechaVence _
                                    , FechaEmision _
                                    , Observacion _
                                    , ANombreDe _
                                    , Estado)


    End Function
    Public Function AnularCheque(ByVal CodigoCheque As String, ByVal Observacion As String) As Boolean
        Return ChequeTerceros.Anular(CodigoCheque, Observacion)
    End Function
    Public Function BuscarCheque(ByVal CodigoCheque As String, _
                                            ByVal Importe As String, _
                                            ByVal FechaVence As String, _
                                            ByVal FechaEmision As String, _
                                            ByVal Observacion As String, _
                                            ByVal ANombreDe As String, _
                                            ByVal Estado As String, _
                                            ByVal Banco As String) As DataSet

        Return ChequeTerceros.BuscarFiltrado(CodigoCheque _
                                    , Importe _
                                    , FechaVence _
                                    , FechaEmision _
                                    , Observacion _
                                    , ANombreDe _
                                    , Estado _
                                    , Banco)


    End Function
    Public Function BuscarNombres(ByVal CodigoCheque As String, _
                                            ByVal Importe As String, _
                                            ByVal FechaVence As String, _
                                            ByVal FechaEmision As String, _
                                            ByVal Observacion As String, _
                                            ByVal ANombreDe As String, _
                                            ByVal Estado As String, _
                                            ByVal Banco As String) As DataSet

        Dim dtsprincipal As DataSet
        dtsprincipal = ChequeTerceros.BuscarFiltrado(CodigoCheque, Importe, FechaVence, FechaEmision, Observacion _
                                                    , ANombreDe, Estado, Banco)
        Dim i As Integer
        dtsprincipal.Tables(0).Columns.Add("impoNombre")
        For i = 0 To dtsprincipal.Tables(0).Rows.Count - 1
            Try
                dtsprincipal.Tables(0).Rows(i)("impoNombre") = dtsprincipal.Tables(0).Rows(i)("Importe").ToString() + " - " + dtsprincipal.Tables(0).Rows(i)("ANombreDe").ToString()
            Catch ex As Exception
                dtsprincipal.Tables(0).Rows(i)("impoNombre") = "ERROR!"
            End Try
        Next
        Return dtsprincipal


    End Function
End Class
